﻿using System;
using RayDen.Library.Core;
using RayDen.RayEngine.Core.Devices;
using RayDen.RayEngine.Core.Interface;
using RayDen.RayEngine.Core.Threads;
using Path = RayDen.RayEngine.Engines.MCMC.PSS.PssDLPathSampler;

namespace RayDen.RayEngine.Engines.MCMC.PSS
{
    [RenderingEngine(EngineType = RenderingEngines.PssMlt)]
    public class PrimarySampleSpaceMLTEngine : BaseRenderingEngine
    {
        public PrimarySampleSpaceMLTEngine(RayEngineScene scene) : base(scene)
        {
        }

        public override RenderThread CreateRenderThread(int threadIndex, IntersectionEngine intersectionDevice, RayEngineScene scene, 
                                                        IImageFilm film, Managers.IFrameManager manager, Core.SamplingContext samplingContext)
        {
            return new DeviceRenderThread<PathBuffer<Path>>(threadIndex, intersectionDevice, scene, LowLatencySampling, film, samplingContext , manager);
            
        }

        public override ISampler CreateSampler(int width, int height, int maxPathDepth, int threadIndex, int screenStartLine, int windowHeight)
        {
            return new PsMltSampler() { sceneMaxPathDepth = maxPathDepth, screenHeight = height, screenWidth = width, screenStartLine = screenStartLine };
        }

        public override IImageFilm CreateFilm(int width, int height)
        {
            return new ImageFilm<Path>(width, height);

        }
    }
}
